package basicJava.generics.generics1;
/*
 * 在JAVA SE5之前，可以让类直接持有Object类型的对象
 * Holder2中可以持有任何类型的对象。
 */
public class Holder2 {
	private Object a;
	public Holder2(Object a){
		this.a = a;
	}
	
	public void set(Object a){
		this.a = a;
	}
	
	public Object get(){
		return a ;
	}
	
	public static void main(String[] args){
		Holder2 h2 = new Holder2(new Automobile());
		Automobile a = (Automobile)h2.get();
		
		System.out.println(a);
		
		h2.set("Not an Automobile");
		String s = (String) h2.get();
		
		System.out.println(s);
		
		h2.set(1);
		int i = (int) h2.get();
		
		System.out.println(i);
	}
}
